package com.woniu.product.mapper;

import com.woniu.product.pojo.ChargePile;
import com.woniu.product.pojo.ChargeRecord;
import com.woniu.product.pojo.ChargeStation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniu.product.entity.dto.FindChargeStationDTO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 充电站表 Mapper 接口
 * </p>
 *
 * @author LiFangyu
 * @since 2023-02-20
 */
public interface ChargeMapper extends BaseMapper<ChargeStation> {

    List<ChargeStation> searchStation(@Param("findChargeStationDTO") FindChargeStationDTO findChargeStationDTO);

    @Select("select * from t_charge_pile where id = #{pileId}")
    @ResultType(ChargePile.class)
    ChargePile getPileStatus(String pileId);

    @Insert("insert into t_charge_record values(#{id},#{pileId},#{userId},#{orderId},#{duration},#{amount},#{isDeleted},#{createdTime},#{updatedTime})")
    @ResultType(boolean.class)
    boolean saveRecord(ChargeRecord chargeRecord);
}
